package chapter5_基础构建模块.队列桌面索引建立任务;

import java.io.File;
import java.io.FileFilter;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class Client {
    public static void main(String[] args) {

    }

    public static void startIndexing(File[] roots) {
        BlockingQueue<File> queue = new LinkedBlockingQueue<>(16);
        FileFilter fileFilter = pathname -> true;

        for (File root : roots) {
            // 启动生产实例
            new Thread(new FileCrawler(queue, fileFilter, root)).start();
        }
        for (int i = 0; i < 5; i++) {
            // 启动消费实例
            new Thread(new Indexer(queue)).start();
        }
    }
}
